/**
 * @(#)ProcessParticipant.java 2009-11-16
 *   
 * Copyright  (c) 2009-2010 Wilmar IT Service,  Inc.   
 * All  rights  reserved.   
 * TODO
 */

package com.wilmar.process.entity;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

/**
 * 参与人实体，其中包含了个人，组织机构，角色信息
 * 
 * @author makubex Email:makubexnet@gmail.com
 * @version 1.1.0
 */
public class ProcessParticipant implements Serializable {

	/**
	 * @serialField
	 */
	private static final long serialVersionUID = -7438650222320785506L;

	private Set<User> userSet;
	private Set<Role> roleSet;
	private Set<Organization> organizationSet;

	private User assigne;

	/**
	 * @return the userSet
	 */
	public Set<User> getUserSet() {
		return userSet;
	}

	/**
	 * @param userSet
	 *            the userSet to set
	 */
	public void setUserSet(Set<User> userSet) {
		this.userSet = userSet;
	}

	/**
	 * @return the roleSet
	 */
	public Set<Role> getRoleSet() {
		return roleSet;
	}

	/**
	 * @param roleSet
	 *            the roleSet to set
	 */
	public void setRoleSet(Set<Role> roleSet) {
		this.roleSet = roleSet;
	}

	/**
	 * @return the organizationSet
	 */
	public Set<Organization> getOrganizationSet() {
		return organizationSet;
	}

	/**
	 * @param organizationSet
	 *            the organizationSet to set
	 */
	public void setOrganizationSet(Set<Organization> organizationSet) {
		this.organizationSet = organizationSet;
	}

	/**
	 * 指定参与人集合,但是不将任务赋予任何一个人,仅用于任务生成到任务池中
	 * 
	 * @param userSet
	 *            用户集合
	 * @param roleSet
	 *            角色集合
	 * @param organizationSet
	 *            机构集合
	 */
	public ProcessParticipant(Set<User> userSet, Set<Role> roleSet,
			Set<Organization> organizationSet) {
		super();
		this.userSet = userSet;
		this.roleSet = roleSet;
		this.organizationSet = organizationSet;
	}

	/**
	 * 完整构造函数
	 * 
	 * @param userSet
	 *            人员集合
	 * @param roleSet
	 *            角色集合
	 * @param organizationSet
	 *            机构集合
	 * @param assigne
	 *            参与人
	 */
	public ProcessParticipant(Set<User> userSet, Set<Role> roleSet,
			Set<Organization> organizationSet, User assigne) {
		super();
		this.userSet = userSet;
		this.roleSet = roleSet;
		this.organizationSet = organizationSet;
		this.assigne = assigne;
		if (this.userSet == null)
			this.userSet = new HashSet<User>();
		this.userSet.add(assigne);
	}

	/**
	 * 默认构造函数
	 */
	public ProcessParticipant() {
		super();
	}

	/**
	 * 直接将任务分配到某一特定人员,该任务将直接在该参与人的待处理任务列表中
	 * 
	 * @param assigne
	 *            参与人
	 */
	public ProcessParticipant(User assigne) {
		super();
		this.assigne = assigne;
		this.userSet = new HashSet<User>();
		this.userSet.add(assigne);
	}

	/**
	 * @return the assigne
	 */
	public User getAssigne() {
		return assigne;
	}

	/**
	 * @param assigne
	 *            the assigne to set
	 */
	public void setAssigne(User assigne) {
		this.assigne = assigne;
		if (this.userSet == null)
			this.userSet = new HashSet<User>();
		this.userSet.add(assigne);
	}

}
